<?php
class changeLanguage extends baseController {    
	public function __construct() {
		parent::__construct ();
	}
    
    public function index($languageCode) {
        $languages = $this->getLanguages();
        $languages[$languageCode] ? $this->session->set_userdata('languageCode', $languageCode) : $this->session->set_userdata('languageCode', 'en');
        $translations = include(APPPATH . 'core/language_'.$this->session->userdata('languageCode').'.php');//include(APPPATH . '/../config/apiconfig.php');
        $this->session->set_userdata('translations', $translations);
        redirect($_SERVER['HTTP_REFERER']);
    }
}
?>